package model;

import java.util.Vector;

public class RoomModel {
	private String name;
	private String type;
	private Vector<ObjectModel> objectList;
	
	public ObjectModel getByName(String name)
	{
		for(int i=0;i<objectList.size();i++)
			if(objectList.get(i).getName().equalsIgnoreCase(name)) return objectList.get(i);
		return null;
	}
	
	public ObjectModel getByType(String type)
	{
		for(int i=0;i<objectList.size();i++)
			if(objectList.get(i).getType().equalsIgnoreCase(type)) return objectList.get(i);
		return null;
	}
	
	public void add(ObjectModel om)
	{
		objectList.add(om);
	}
	
	public RoomModel(String name,String type)
	{
		this.name=name;
		this.type=type;
		objectList=new Vector<ObjectModel>();
	}

	public RoomModel() {
		objectList=new Vector<ObjectModel>();
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getType() {
		return type;
	}
	
	public String toString()
	{
		String str=new String();
		str="\n\nRoomName: "+name +" Roomtype: "+type;
		for(int i=0;i<objectList.size();i++)
			str+=objectList.get(i).toString();
		return str;
	}

	public void setType(String type) {
		this.type = type;
	}

	public Vector<ObjectModel> getObjectList() {
		return objectList;
	}

	public void setObjectList(Vector<ObjectModel> objectList) {
		this.objectList = objectList;
	}
}
